<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="./css/bulma.min.css">
    <link rel="stylesheet" type="text/css" href="./css/class-details.css">
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css">
    <script type="text/javascript" src="./js/class-details.js"></script>
    <title>class-detail</title>
</head>

<body>
    <div class="border">
        <div class="top">
            <div class="change-scene">
                <i class="fa fa-magic"></i>
            </div>
            <div class="class-info">
                <div class="class-name">
                    <span th:text="${class.className}"></span>
                </div>
                <div class="student-number">
                    <i class="fa fa-users"></i>
                    <span th:text="${(students.size()-1)+'/'+codes.size()}"></span>
                    <a class="add-invite-code" onclick="codeAdd()">
                        <i class="fa fa-plus"></i>
                        <span>扩充邀请码</span>
                    </a>
                </div>
                <div class="teacher">
                    <span>任课老师:</span>
                    <span th:text="${'@'+class.userName}"></span>
                </div>
                <div class="time-table">
                    <i class="fa fa-clock-o"></i>
                    <span>45:00</span>
                </div>
            </div>
            <div class="user-info">
                <form th:if="${session.user} ne null">
                    <img th:src="${session.user.getHeadImage()}">
                </form>
            </div>
        </div>
        <div class="center">
            <div class="students-view">
                <div class="student" th:each="student:${students}" th:unless="${class.masterId==student.userId}">
                    <img th:src="${student.headImage}">
                    <div class="stu-name" th:text="${student.userName}"></div>
                    <div class="msg-bubble"></div>
                    <div class="online"></div>
                </div>
            </div>
            <div class="teacher-view">
                <div class="t-desk">
                    <img th:src="${class.headImage}">
                    <span th:text="${class.userName}"></span>
                </div>
            </div>
        </div>
        <div class="bottom">
            <a class="notice">
                <i class="fa fa-calendar-o"></i>
                <span>发布公告</span>
            </a>
            <a class="homework">
                <i class="fa fa-pencil-square"></i>
                <span>发布作业</span>
            </a>
            <a class="begin">
                <i class="fa fa-play"></i>
                <span>开始上课</span>
            </a>
            <a class="chat">
                <input type="text" placeholder="发表留言">
                <i class="fa fa-send"></i>
            </a>
        </div>
    </div>
    <div class="add-code-box-border">
        <div class="add-code-box">
            <div class="add-number">
                <input type="text" maxlength="2" oninput="value=value.replace(/[^\d]/g,'')" placeholder="填写扩充数量">
                <a class="button is-primary confirm-add" onclick="createCode(this)">确定</a>
                <input type="text" th:value="${class.classId}" style="display: none;">
                <a class="button max-add">最大</a>
                <a class="button cancel" onclick="cancelAdd()">取消</a>
            </div>
            <div class="exist-codes">
                <div class="code-title">已添加的邀请码</div>
                <div class="codes">
                    <div class="codeItem" th:each="code,codeStatus:${codes}">
                        <span th:text="${codeStatus.index+1}"></span>
                        <code th:text="${code.code}"></code>
                        <span class="used-status" th:unless="${code.isUsed}">未使用</span>
                        <span class="used-status" th:if="${code.isUsed}">已使用</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>